//package com.magina.project.config;
//
//import com.alibaba.druid.pool.DruidDataSource;
//import org.springframework.beans.factory.annotation.Autowired;
//import org.springframework.context.annotation.Bean;
//import org.springframework.context.annotation.Configuration;
//import org.springframework.core.env.Environment;
//
//import javax.sql.DataSource;
//
///**
// * @ClassnName :com.magina.project.config.DataSourceConfig
// * @Author： Magina.Hu
// * @Date： 2019/5/14
// * @Description： 用代码配置dataSource config 选择config.yaml 配置选其一
// * @Version: V1.0
// * Copyright (c) 2019-2020 .All rights reserved.
// */
//@Configuration
//public class DataSourceConfig {
//
//    @Autowired
//    private Environment env;
//
//    private static final String JDBC_URL;
//    private static final String DRIVER_CLASS;
//    private static final String USERNAME;
//    private static final String PASSWORD;
//
//
//    static {
//        JDBC_URL = "spring.datasource.url";
//        DRIVER_CLASS = "com.mysql.jdbc.Driver";
//        USERNAME = "spring.datasource.username";
//        PASSWORD = "spring.datasource.password";
//    }
//
//    @Bean(name = "datasource")
//    public DataSource getDataSource() {
//        DruidDataSource dataSource = new DruidDataSource();
//
//        dataSource.setUrl(env.getProperty(JDBC_URL));
//        dataSource.setDriverClassName(env.getProperty(DRIVER_CLASS));
//        dataSource.setUsername(env.getProperty(USERNAME));
//        dataSource.setPassword(env.getProperty(PASSWORD));
//        return dataSource;
//    }
//}